﻿namespace PokerSimulator
{
	using System.Globalization;

	public class Card
	{
		public const int LargestCardValue = 14;
		public const int SmallestCardValue = 2;

		private char _suit;
		private int _value;

		public Card()
		{
			Suit = 'X';
		}

		public Card(int value, char suit)
		{
			Value = value;
			Suit = suit;
		}

		public char Suit
		{
			get { return _suit; }
			set { _suit = value; }
		}

		public int Value
		{
			get { return _value; }
			set { _value = value; }
		}

		public override string ToString()
		{
			return string.Concat(ConvertToShortRepresentation(), Suit);
		}

		private string ConvertToShortRepresentation()
		{
			switch (Value)
			{
				case 14:
					return "A";
				case 13:
					return "K";
				case 12:
					return "Q";
				case 11:
					return "J";
				default:
					return Value.ToString(CultureInfo.CurrentCulture);
			}
		}

		public static string ConvertToCardName(int value)
		{
			switch (value)
			{
				case 14:
					return "Ace";
				case 13:
					return "King";
				case 12:
					return "Queen";
				case 11:
					return "Jack";
				default:
					return value.ToString(CultureInfo.InvariantCulture);
			}
		}
	}
}